* {
	box-sizing: border-box;
}

/* Main page tokens shared by layout and print preview host elements. */

/* Verse card header for activity tile */
.verse-card-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5em;
}
.verse-card-date {
	font-size: 0.95em;
	color: #555;
	font-style: italic;
	flex: 0 0 auto;
}
.verse-card-theme {
	font-size: 0.95em;
	color: #555;
	font-weight: 600;
	flex: 1 1 auto;
	text-align: right;
}


:root {
	--activity-title-sticky-top: 72px;
	--print-page-height: 11in;
	--print-page-margin-y: .2in;
	--print-page-margin-x: .5in;
}

body {
	margin: 0;
	font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
	background: #f7f7f7;
	color: #1f1f1f;
	display: flex;
	flex-direction: column;
}

/* Page shell and introduction area. */
.page-shell {
	max-width: 1200px;
	margin: 0 auto;
	padding: 1rem;
}

.page-header {
	background: #ffffff;
	border: 1px solid #e2e2e2;
	border-radius: 12px;
	padding: 1rem;
	margin-bottom: 1rem;
}

.title {
	margin: 0 0 .5rem;
    font-family: cheese;
	font-size: clamp(2.1rem, 4vw, 2.8rem);
    text-align: center;
}

.subtitle {
    font-family: candy;
    font-size: clamp(1.1rem, 4vw, 1.8rem);
    text-align: center;
    
    color: #555;
    margin: 0 0 1em;
}

.directions {
	margin: 0;
	line-height: 1.45;
}

.content-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 1rem;
}

/* Form controls and toolbar rows used across dialogs and top controls. */
.setup-panel,
.list-panel {
	background: #ffffff;
	border: 1px solid #e2e2e2;
	border-radius: 12px;
	padding: 1rem;
}

label {
	display: block;
	margin: .5rem 0 .35rem;
	font-weight: 600;
}

input[type="text"],
input[type="date"] {
	width: 100%;
	border: 1px solid #cfcfcf;
	border-radius: 8px;
	padding: .6rem .75rem;
	font-size: 0.95rem;
	background: #fff;
}

.selected-verse-box {
	border: 1px solid #d8d8d8;
	border-radius: 10px;
	padding: .8rem;
	margin: .9rem 0;
	background: #fbfbfb;
}

.selected-verse-box h3 {
	margin: 0 0 .5rem;
	font-size: 1rem;
}

.selected-reference {
	margin: 0 0 .5rem;
	font-weight: 600;
}

.selected-passage {
	margin: 0;
	line-height: 1.45;
	color: #353535;
}

.form-row {
	margin-bottom: .75rem;
}
.time-period-options {
	display: flex;
	gap: .75rem;
	flex-wrap: wrap;
	margin-top: .2rem;
}
.time-period-option {
	display: inline-flex;
	align-items: center;
	gap: .45rem;
	margin: 0;
	padding: .55rem .8rem;
	border: 1px solid #cfcfcf;
	border-radius: 8px;
	background: #fff;
	font-weight: 500;
	cursor: pointer;
}
.time-period-option input {
	margin: 0;
}

.control-row {
	display: flex;
	gap: .6rem;
	margin: .8rem 0;
	flex-wrap: wrap;
}

.action-buttons {
	margin-top: 1rem;
}

#topActionButtons {
	display: flex;
	flex-direction: row;
	justify-content: center;
	align-items: center;
	gap: .6rem;
	flex-wrap: wrap;
	background: transparent;
	padding: .3rem 0;
	margin-top: 0;
}

.top-action-row {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: .6rem;
	flex-wrap: wrap;
	width: 100%;
}

.top-action-row-buttons {
	position: sticky;
	top: 0;
	z-index: 50;
	background: rgba(247, 247, 247, 0.96);
	padding: .45rem 0;
	margin-bottom: 0;
	backdrop-filter: blur(2px);
}

#stickyActionButtons {
	border: 1px solid #d6deef;
	border-radius: 12px;
	box-shadow: 0 2px 8px rgba(15, 23, 42, .1);
	padding: .5rem .7rem;
	width: 100%;
}

.top-action-field {
	display: flex;
	align-items: center;
	gap: .4rem;
}

.top-action-field.church-name-field {
	padding: .38rem .52rem;
	background: transparent;
	border-radius: 10px;
}

.top-action-field label {
	margin: 0;
	font-weight: 600;
	font-size: .9rem;
	white-space: nowrap;
}

#topActionButtons input,
#topActionButtons select {
	width: auto;
	min-width: 128px;
	max-width: 240px;
	margin: 0;
	font-size: 0.95rem;
}

#topActionButtons select#defaultVersionSelect {
	min-width: 84px;
	max-width: 84px;
	width: 84px;
	height: 2.25rem;
	padding: .5rem .55rem;
	border: 1px solid #cfcfcf;
	border-radius: 8px;
	background: #fff;
}

/* Input wrapper and clear button for church name field. */
.input-wrapper {
	display: inline-flex;
	align-items: center;
	width: auto;
	min-width: 128px;
	max-width: 280px;
	min-height: 2.25rem;
	border: 1px solid #cfcfcf;
	border-radius: 8px;
	background: #fff;
	overflow: hidden;
    padding-right: 0.25em;
}

.input-wrapper input {
	flex: 1;
	border: none;
	background: transparent;
	padding: 0.5rem 0.75rem;
	font-size: 0.95rem;
	font-weight: 600;
	color: #2f2f2f;
	outline: none;
}

.input-wrapper input:focus {
	outline: none;
}

/* Force Group Name textbox color so it is clearly visible. */
#churchNameInput {
	background: transparent !important;
	color: #2f2f2f !important;
	font-weight: 600;
}

#churchNameInput::placeholder {
	color: #888;
	opacity: 1;
}

.clear-input-btn {
	position: static;
	background: linear-gradient(180deg, #f8f8f8 0%, #ececec 100%);
	border: 1px solid #c9c9c9;
	border-left: 1px solid #d9d9d9;
	cursor: pointer;
	min-width: 2rem;
	width: 2rem;
	height: 1.85rem;
	display: inline-flex;
	align-self: center;
	align-items: center;
	justify-content: center;
	padding: 0;
	font-size: 0.95rem;
	font-family: Arial, Helvetica, sans-serif;
	font-weight: 700;
	color: #4a4a4a;
	line-height: 1;
	transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.06s ease;
	border-radius: 6px;
	flex-shrink: 0;
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.clear-input-btn:hover {
	background: linear-gradient(180deg, #ffffff 0%, #efefef 100%);
	border-color: #b9b9b9;
}

.clear-input-btn:active {
	background: #e5e5e5;
	transform: translateY(1px);
}

.activity-tiles {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: .75rem;
	margin-bottom: 1rem;
}

/* Activity cards and verse tile actions. */
.dialog-select {
	width: 100%;
	border: 1px solid #cfcfcf;
	border-radius: 8px;
	padding: .6rem .75rem;
	font-size: 0.95rem;
	background: #fff;
}

.activity-tile {
	background: #ffffff;
	border: 1px solid #e2e2e2;
	border-radius: 12px;
	padding: .85rem;
}

.activity-tile-title {
	display: flex;
	align-items: center;
	position: sticky;
	top: var(--activity-title-sticky-top);
	z-index: 12;
	margin: 0 0 .45rem;
	color: #1d3f8f;
	background: linear-gradient(180deg, #eef4ff 0%, #dfeafe 100%);
	border: 1px solid #cadcff;
	border-radius: 12px;
	padding: .35rem .5rem .35rem .75rem;
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, .85);
}

.activity-tile-name {
	flex: 1;
	text-align: center;
	font-size: clamp(1.05rem, 3.5vw, 1.7rem);
	font-weight: 700;
	letter-spacing: .02em;
}

.btn-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	width: 2rem;
	height: 2rem;
	font-size: 1.05rem;
	padding: 0;
	border-radius: 8px;
	border: 1px solid transparent;
	background: transparent;
	cursor: pointer;
	color: inherit;
	transition: background .12s ease, color .12s ease;
}

.btn-icon-neutral:hover {
	background: #d7e4ff;
	color: #1d3f8f;
	border-color: #b9cffb;
}

.btn-icon-danger {
	color: inherit;
}

.btn-icon-danger:hover {
	background: #c5342f;
	color: #fff;
	border-color: #c5342f;
}

.btn-icon-primary {
	color: #265cc2;
}

.btn-icon-primary:hover {
	background: #2f6feb;
	color: #fff;
	border-color: #2f6feb;
}

.activity-start-date {
	margin: .45rem 0 .75rem;
	color: #545454;
	font-size: .92rem;
	text-align: center;
	min-height: 1.3rem;
}

.activity-start-date.is-empty {
	visibility: hidden;
}

.activity-tile-actions {
	display: flex;
	justify-content: center;
	gap: .6rem;
	flex-wrap: wrap;
	margin-bottom: .75rem;
}

.activity-verse-list {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
	gap: .65rem;
	margin-top: .75rem;
}

.activity-verse-card {
	border: 1px solid #dadada;
	border-radius: 10px;
	padding: .65rem .65rem .25rem;
	background: #fafafa;
}

.activity-verse-card .control-row {
	margin: .45rem 0 0;
}

.activity-verse-card h4 {
	margin: 0 0 .3rem;
	font-size: .98rem;
}

.activity-verse-content {
	display: flex;
	gap: .75rem;
	align-items: center;
	background: #fafafa;
	border: 1px solid #d6dff5;
	border-radius: 8px;
	padding: 0;
	margin: .35rem 0;
}

.activity-verse-content > p {
	flex: 1;
	min-width: 0;
	margin: 0;
	line-height: 1.45;
	background: #ffffff;
	border: 1px solid #dbe4f7;
	border-radius: 8px;
	padding: .65rem .75rem;
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, .85);
}

.activity-verse-qr {
	flex-shrink: 0;
	background: #ffffff;
	border: 1px solid #dbe4f7;
	border-radius: 8px;
	padding: .45rem;
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, .85);
}

/* webpage */
.activity-verse-qr img,
.activity-verse-qr canvas {
	display: block;
	border-radius: 4px;
}

.activity-verse-qr {
	cursor: pointer;
}

.app-toast {
	position: fixed;
	left: 50%;
	bottom: 22px;
	transform: translateX(-50%);
	background: rgba(20, 20, 20, 0.92);
	color: #fff;
	padding: .55rem .8rem;
	border-radius: 10px;
	font-size: .9rem;
	opacity: 0;
	pointer-events: none;
	transition: opacity .2s ease;
	z-index: 90;
}

.app-toast.show {
	opacity: 1;
}

/* Dialog shell + button variants used by activity and print dialogs. */
.activity-dialog {
	width: min(520px, 92vw);
	border: 1px solid #cecece;
	border-radius: 12px;
	padding: 0;
}

.activity-dialog::backdrop {
	background: rgba(0, 0, 0, .35);
}

.btn {
	border: 1px solid #b7b7b7;
	border-radius: 8px;
	background: linear-gradient(180deg, #f7f7f7 0%, #ececec 100%);
	color: #1f1f1f;
	padding: .55rem .85rem;
	font-size: .94rem;
	cursor: pointer;
	font-weight: 600;
	box-shadow: 0 1px 2px rgba(15, 23, 42, .12);
	transition: transform .08s ease, box-shadow .12s ease, background .12s ease;
}

.btn:hover {
	background: linear-gradient(180deg, #f1f1f1 0%, #e4e4e4 100%);
	box-shadow: 0 2px 6px rgba(15, 23, 42, .18);
}

.btn:active {
	transform: translateY(1px);
}

.btn:disabled {
	opacity: .55;
	cursor: not-allowed;
}

.btn-primary {
	background: #2f6feb;
	color: #fff;
	border-color: #2f6feb;
}

.btn-primary:hover {
	background: #265cc2;
}

.btn-accent {
	background: #0c8d4a;
	color: #fff;
	border-color: #0c8d4a;
}

.btn-accent:hover {
	background: #096f3b;
}

.btn-danger {
	background: #c5342f;
	color: #fff;
	border-color: #c5342f;
}

.btn-danger:hover {
	background: #a42925;
}

.status-message {
	min-height: 1.2rem;
	margin: 0;
	font-size: 1.05rem;
	font-weight: 700;
	color: #b8860b;
	text-align: center;
	flex-basis: 100%;
}

.status-message.error {
	color: #b42318;
}

.hidden {
	display: none !important;
}

/* Shared footer row for dialog actions. */
.dialog-footer {
	margin-top: 1rem;
	display: flex;
	justify-content: space-between;
}

@media (max-width: 960px) {
	/* Collapse two-column regions for tablet and narrow desktop widths. */
	.activity-tiles,
	.content-grid,
	.testament-grid {
		grid-template-columns: 1fr;
	}

	.dialog-footer {
		flex-direction: column;
		gap: .5rem;
	}

	.dialog-footer .btn {
		width: 100%;
	}
}


.control-row-small {
	gap: 0.2rem;
	flex-direction: row;
	align-items: center;
	justify-content: flex-start;
}
.btn-sm {
	font-size: 0.92rem;
	padding: 0.32rem 0.7rem;
	min-width: 32px;
	min-height: 32px;
	border-radius: 0.5rem;
}

/* Mobile Styles */
@media (max-width: 600px) {
	/* Tighten spacing and stack card internals for handset screens. */
	.page-shell {
		padding: 0.3rem;
		max-width: 100vw;
	}
	.page-header {
		padding: 0.7rem 0.5rem;
		margin-bottom: 0.7rem;
		border-radius: 0;
	}
	.title {
		font-size: 1.2rem;
	}
	.directions {
		font-size: 0.98rem;
		padding: 0 0.2rem;
	}
	.activity-tiles {
		grid-template-columns: 1fr;
		gap: 0.5rem;
		margin-bottom: 0.5rem;
	}
	.activity-tile {
		padding: 0.5rem;
		border-radius: 0.7rem;
	}
	.activity-tile-title {
		font-size: 1.1rem;
		padding: 0.3rem 0.4rem;
		border-radius: 0.7rem;
	}
	.activity-tile-name {
		font-size: 1.1rem;
	}
	.activity-verse-list {
		grid-template-columns: 1fr;
		gap: 0.5rem;
	}
	.activity-verse-card {
		padding: 0.5rem 0.3rem 0.2rem;
		border-radius: 0.7rem;
	}
	.activity-verse-card .control-row {
		justify-content: center;
	}
	.activity-verse-content {
		flex-direction: column;
		gap: 0.4rem;
		padding: 0.2rem 0;
	}
	.activity-verse-content > p {
		padding: 0.5rem 0.5rem;
		font-size: 0.98rem;
	}
	.activity-verse-qr {
		padding: 0.2rem;
		margin: 0 auto;
		max-width: 90vw;
	}
	.print-sheet {
		padding: 0.2in 0.1in;
		max-width: 100vw;
		border-radius: 0;
	}
	.print-header {
		margin-bottom: 0.4rem;
	}
	.print-logo {
		width: 60px;
		height: 60px;
	}
	.print-brand-row {
		gap: 0.4rem;
		margin-bottom: 0.2em;
	}
	.print-header h1.print-brand {
		font-size: 1.7rem;
	}
	.print-header h1 {
		font-size: 1rem;
	}
	.print-verse-item {
		margin: 0.3rem 0;
	}
	.print-verse-content {
		flex-direction: column;
		gap: 0.3rem;
		padding: 0.2rem 0;
	}
	.print-verse-text {
		margin: 0.2rem;
		padding: 0.2rem;
	}
	.print-verse-text > .print-verse-passage {
		font-size: 0.98rem;
	}
	.print-verse-qr-wrapper {
		margin: 0.2rem auto;
		padding: 0.2rem;
		border-radius: 0.5rem;
	}
	.dialog-shell {
		padding: 0.5rem;
	}
	.dialog-header {
		padding: 0.2rem 0;
	}
	.dialog-header h2 {
		font-size: 1.1rem;
	}
	.dialog-select, input[type="text"], input[type="date"] {
		font-size: 1rem;
		padding: 0.5rem 0.5rem;
	}

	.btn, .btn-primary, .btn-accent, .btn-danger {
		font-size: 1rem;
		padding: clamp(0.32rem, 2vw, 0.5rem) clamp(0.5rem, 4vw, 0.7rem);
		min-width: 44px;
		min-height: 44px;
		border-radius: 0.7rem;
	}

	.button.btn.btn-primary.btn-sm {
		padding: 0.4rem 0.6rem;
		background-color: purple;
	}

	/* Hide QR code image for verse cards on mobile */
	.activity-verse-qr {
		display: none;
	}
	.control-row {
		gap: 0.3rem;
		flex-direction: column;
		align-items: stretch;
	}

	/* Make verse-tile control-row horizontal on mobile */
	.activity-verse-card .control-row {
		flex-direction: row;
		align-items: center;
	}
	.form-row {
		margin-bottom: 0.5rem;
	}
	.verse-row {
		padding: 0.4rem 0.4rem;
		font-size: 1rem;
	}
	.verse-selector-dialog, .activity-dialog {
		width: 98vw;
		min-width: 0;
		max-width: 100vw;
		border-radius: 0.7rem;
	}
	.step-indicator {
		gap: 0.2rem;
		font-size: 0.95rem;
	}
	.button-wrap {
		gap: 0.2rem;
		max-height: 60vw;
	}
}
